package com.fsm.demo.controller;

import com.fsm.common.log.config.LogData;
import com.fsm.common.log.entity.dto.OperationEnum;
import com.fsm.common.log.entity.dto.SystemTypeEnum;
import jakarta.servlet.http.HttpServletResponse;
import com.fsm.common.tools.Result.Result;
import com.mybatisflex.core.paginate.Page;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import com.fsm.demo.entity.ClientInfo;
import com.fsm.demo.service.ClientInfoService;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import java.io.Serializable;
import java.util.List;

/**
*  客户信息控制层。
*
* @author 翻山鸣
* @since
*/
@RestController
@Tag(name = "客户信息")
@RequestMapping("/clientInfo")
public class ClientInfoController {

	@Autowired
	private ClientInfoService oClientInfoService;

	/**
    * 添加客户信息
    *
    * @param clientInfo
    * @return
    */
	@LogData(value = "添加客户信息",operation = OperationEnum.INSERT,systemTypeEnum = SystemTypeEnum.BACKEND)
    @PostMapping("addClientInfo")
    @Operation(summary="添加客户信息",description="添加客户信息")
    public Result addClientInfo(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.addClientInfo(clientInfo);
	}

	/**
	* 逻辑删除客户信息
	*
	* @param clientInfo
	* @return
	*/
	@LogData(value = "逻辑删除客户信息",operation = OperationEnum.DELETE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("logicDeleteClientInfo")
	@Operation(summary="逻辑删除客户信息",description="逻辑删除客户信息")
	public Result logicDeleteClientInfo(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.logicDeleteClientInfo(clientInfo);
	}

	/**
	* 删除客户信息
	*
	* @param clientInfo
	* @return
	*/
	@LogData(value = "删除客户信息",operation = OperationEnum.DELETE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("deleteClientInfo")
	@Operation(summary="删除客户信息",description="删除客户信息")
	public Result deleteClientInfo(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.deleteClientInfo(clientInfo);
	}

	/**
	* 更新客户信息
	*
	* @param clientInfo
	* @return
	*/
	@LogData(value = "更新客户信息",operation = OperationEnum.UPDATE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("updateClientInfo")
	@Operation(summary="更新客户信息",description="更新客户信息")
	public Result updateClientInfo(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.updateClientInfo(clientInfo);
	}

	/**
	* 分页查询客户信息
	*
	* @param clientInfo
	* @return 分页对象
	*/
	@LogData(value = "分页查询客户信息",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("pageClientInfo")
	@Operation(summary="分页查询客户信息",description="分页查询客户信息")
	public Result pageClientInfo(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.pageClientInfo(clientInfo);
	}

	/**
	* 查询客户信息列表
	*
	* @param clientInfo
	* @return 分页对象
	*/
	@LogData(value = "查询客户信息",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("getClientInfoList")
	@Operation(summary="查询客户信息列表",description="查询客户信息列表")
	public Result getClientInfoList(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.getClientInfoList(clientInfo);
	}

	/**
	* 通过ID查询客户信息
	*
	* @param clientInfo
	* @return
	*/
	@LogData(value = "通过ID查询客户信息",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("getClientInfoById")
	@Operation(summary="通过ID查询客户信息",description="通过ID查询客户信息")
	public Result getClientInfoById(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.getClientInfoById(clientInfo);
	}

    /**
    * 导出信息
    *
    * @param
    * @return 分页对象
    */
	@LogData(value = "导出信息",operation = OperationEnum.EXPORT,systemTypeEnum = SystemTypeEnum.BACKEND)
    @PostMapping("uploadClientInfoData")
    @Operation(summary="导出信息",description="导出信息")
    public Result uploadClientInfoData(@RequestBody ClientInfo clientInfo, HttpServletResponse response) throws Exception{
         return oClientInfoService.uploadClientInfoData(clientInfo,response);
    }


	/**
	* 冻结客户信息
	*
	* @param clientInfo
	* @return
	*/
	@LogData(value = "冻结客户信息",operation = OperationEnum.UPDATE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("freezeClientInfo")
	@Operation(summary="冻结客户信息",description="冻结客户信息")
	public Result freezeClientInfo(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.freezeClientInfo(clientInfo);
	}

	/**
	* 解冻客户信息
	*
	* @param clientInfo
	* @return
	*/
	@LogData(value = "解冻客户信息",operation = OperationEnum.UPDATE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("thawClientInfo")
	@Operation(summary="解冻客户信息",description="解冻客户信息")
	public Result thawClientInfo(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.thawClientInfo(clientInfo);
	}
	/**
	* 审核通过客户信息
	*
	* @param clientInfo
	* @return
	*/
	@LogData(value = "审核通过客户信息",operation = OperationEnum.UPDATE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("approvedClientInfo")
	@Operation(summary="审核通过客户信息",description="审核通过客户信息")
	public Result approvedClientInfo(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.approvedClientInfo(clientInfo);
	}

	/**
	* 审核驳回客户信息
	*
	* @param clientInfo
	* @return
	*/
	@LogData(value = "审核驳回客户信息",operation = OperationEnum.UPDATE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("reviewClientInfo")
	@Operation(summary="审核驳回客户信息",description="审核驳回客户信息")
	public Result reviewClientInfo(@RequestBody ClientInfo clientInfo) throws Exception{
		return oClientInfoService.reviewClientInfo(clientInfo);
	}

}
